﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Plat.WfProcess.DataModel;

namespace Plat.WfProcess.Business
{
    public class RoleManager
    {
        private RoleRepository _roleRepository;
        private RoleRepository roleRepository
        {
            get
            {
                if (_roleRepository == null)
                {
                    _roleRepository = new RoleRepository();
                }
                return _roleRepository;
            }
        }

        public RoleEntity Select(long roleID)
        {
            
            return roleRepository.SelectById(roleID.ToString());
        }

        public IList<RoleEntity> Select(int pageIndex,
            int pageSize,
            string orderBy,
            out long allRowsCount,
            string where,
            params object[] values)
        {
            return roleRepository.Select(pageIndex, pageSize, out allRowsCount, orderBy, false, where, values);
        }

        public IList<RoleEntity> SelectAll()
        {
            return roleRepository.SelectAll();
        }

        public long Insert(RoleEntity entity)
        {
            return roleRepository.Insert(entity).RoleID;
        }

        public void Update(RoleEntity entity)
        {
            roleRepository.Update(entity);
        }
    }
}
